package book;

/**
 * Created with IntelliJ IDEA.
 * Description: 该类是用来存储借阅信息的
 * User: 87111
 * Date: 2025-08-24
 * Time: 18:09
 */
public class PairOfUidAndBookId {
    //用户id
    private int userId;
    //书id
    private int bookId;

    public PairOfUidAndBookId() {

    }
    public PairOfUidAndBookId(int userId, int bookId) {
        this.userId = userId;
        this.bookId = bookId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getBookId() {
        return bookId;
    }

    public void setBookId(int bookId) {
        this.bookId = bookId;
    }

    //将对象转换为字符串
    public String toJson() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(userId).append(",");
        stringBuilder.append(bookId);
        return stringBuilder.toString();
    }

    @Override
    public String toString() {
        return "PairOfUidAndBookId{" +
                "userId=" + userId +
                ", bookId=" + bookId +
                '}';
    }
}
